<template>
    <div class="tmp">
        <!--标题-->
        <h4 class="page-header">{{moveinfo.title}}
        
         <b class="mui-tab-item fr" @click="likeit">
				<span class="mui-icon mui-icon-extra mui-icon-extra-heart-filled"></span>
		</b>
        </h4>

        <div class="img">
            <!--图片-->
            <img v-bind="{src:largeImg}" alt="">
        </div>
        <div class="info">
            <!--国家-->
            <p>国家：<span>{{moveinfo.countries | shuzufmt}}</span></p>
            <!--类型-->
            <p>类型：<span>{{moveinfo.genres | shuzufmt}}</span></p>
            <!--主演-->
            <p>主演：<span v-for="item in moveinfo.casts">{{item.name}}&nbsp;&nbsp;</span></p>
            <!--别名-->
            <p>别名：<span>{{moveinfo.aka | shuzufmt}}</span></p>
        </div>
        <!--简介-->
        <div class="content">简介：<span class="icontent">{{moveinfo.summary}}</span></div>

        <conment :conmentid="conmentid"></conment>

    </div>
</template>

<script>
import common from '../common/common.js';
import conment from '../common/conment.vue'

import {setLike,getObj} from '../common/location.js';
import {vm,KEY} from '../common/likeparams.js'
export default{
    name:'movieinfo',
    data(){
        return{
            moveinfo:{},
            largeImg:'',//定义一个空字符串
            conmentid:0
        }
    },
    created(){
        this.conmentid=this.$route.params.id;
        this.getJectInfo();
    },
    methods:{
        getJectInfo(){
            let that = this;
            let id = this.$route.params.id;
            
            let url = common.apihost + '/v2/movie/subject/' + id;
            this.$http.jsonp(url,{
              params:{
                  apikey:common.apikey,
              },
              headers:{},emlateJSON:true}).then(res=>{
                this.moveinfo = res.body;
                //console.log(this.moveinfo)
                this.largeImg = res.body.images.large;
            })
        },
        likeit(){
            //alert(this.conmentid);
            setLike({like:this.conmentid});
            vm.$emit(KEY,1);
        }
    },
    components:{conment}
}
</script>

<style>
.tmp {
   background-color: #fff;
   padding: 0 20px;
   padding-bottom: 82px;
}
.img {
  text-align: center;
}
.info >p,.content{
  font-size: 20px;
  font-weight: 700;
  padding-top: 10px;
}
.fr{
    float: right;
}

.content >.icontent,.info >p span{
  display: block;
  padding-top:6px;
  font-size: 16px;
  font-weight: 400;
  line-height: 30px;
}
.info >p span {
  display: inline;
}
</style>